package com.huanghao.mapper;

import java.sql.Date;
import java.time.LocalDate;
import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import com.huanghao.pojo.Commod;

@Mapper
@Repository
public interface CommodMapper {
    
    //删除/批量删除
    void deleteByid(@Param("list")  List<Integer> list);
    
    //新增,完成
    @Insert("INSERT INTO commod(`cName`,`cNumber`,`cInventory`,`cPrice`,`cSales`,`cData`,`flag`) VALUES(#{cName},#{cNumber},#{cInventory},#{cPrice},#{cSales},#{cData},1)")
    void insert(Commod emp);
    
    List<Commod> list(@Param("cName") String cName,@Param("cNumber")  Integer cNumber,@Param("cPrice") Integer cPrice,
    		@Param("cInventory") Integer cInventory,@Param("begin") Date begin,@Param("end") Date end,@Param("cSales") Integer cSales);

	void update(Commod emp);

	//根据ID查询
	@Select("select * from commod where cNumber = #{cNumber} and flag = 1")
	Commod getById(Integer id);
}
